package com.controller;

import com.pojo.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class Mycontroller {
    //json传输对象
    @RequestMapping("addOne")
    public User addOne(@RequestBody User user){
        System.out.println("Mycontroller.addOne"+user);
        return user;
    }
    //json传输字符串
    @RequestMapping("findOne")
    public String   findOne(@RequestBody String user){
        System.out.println("Mycontroller.findOne"+user);
        return user;
    }
    //json传输数组
    @RequestMapping("findArray")
    public int[]   findArray(@RequestBody int[] array){
        for (int i :array) {
            System.out.println("Mycontroller.findArray  "+i);
        }
        return array;
    }
    //json 传输list集合
    @RequestMapping("findList")
    public List<Integer>    findList(@RequestBody List<Integer> list){
        for (Integer i : list) {
            System.out.println("Mycontroller.findList"+i);
        }
        return list;
    }
    //json传输map 集合
    @RequestMapping("findMap")
    public Map<String,User> findMap (@RequestBody Map<String,User> map){
        return map;
    }
    //json 传输List里包含Map集合
    @RequestMapping("findListMap")
    public List<Map<String,User>> findListMap   (@RequestBody List<Map<String,User>> list){
        return list;
    }
}
